\ Set our buffer to 1
: BUFFER_INVERT ( -- ) 1 SET_BUFFER ;

\ Setup for invert cipher
: SETUP_INVERT ( -- )  BUFFER_INVERT ;

\ Encrypt by flipping the bits 
: ENCRYPT_INVERT ( -- ) SETUP_INVERT
	READ_LINE
	0 EOF = IF
		
	ELSE
		BEGIN
			\ Fetch the char value, and invert the bits
			lineBuffer c@ INVERT lineBuffer c!
			WRITE_LINE
			READ_LINE
			0 EOF =
		UNTIL
	ENDIF ;

\ Decrypt by flipping the bits
: DECRYPT_INVERT ( -- ) SETUP_INVERT
	READ_LINE
	0 EOF = IF
		
	ELSE
		BEGIN
			\ Fetch the char value and invert the bits
			lineBuffer c@ INVERT lineBuffer c!
			WRITE_LINE
			READ_LINE
			0 EOF =
		UNTIL
	ENDIF ;
